Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Allow SYCL_EXTERNAL to be applied to a function with raw pointers #861

Merged
merged 4 commits into from
Dec 5, 2019

Conversation

asavonic
Copy link
Contributor

SYCL 1.2.1 specification does not allow SYCL_EXTERNAL to be applied to
a function with a pointer argument or with a pointer return
value. This is required to limit address space inference work to a
single translation unit.

Given that we make inference after we link all translation units
together, it should not really matter now. And there are several cases
where external functions with pointers can be useful, so this patch
tuns an error into a warning.

Signed-off-by: Andrew Savonichev andrew.savonichev@intel.com

@asavonic asavonic force-pushed the private/asavonic/sycl-external-ptr branch from 96fe0f6 to f73cc65 Compare November 25, 2019 15:57
Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General feedback: IMO, the warning is strange. I understand that we can't just wipe out the diagnostic because it's required by the current spec, but warning about nothing (in case of our implementation), and which will be emitted because we are going to use possibility allowed by this change seems strange for me.

And there are several cases where external functions with pointers can be useful
I prefer explicitly mention some kind of such use cases...

: Warning<"%0 attribute applied to a "
"%select{function with a raw pointer return type"
"|function with a raw pointer parameter type}1"
" may prevent optimizations related to address spaces">,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that "may prevent optimizations related to address spaces" is useful information. How about telling the truth: it should not really matter for our implementation, but it's not following the current SYCL spec.
Other option is to guard this behavior under some command line option, see #806 .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "SYCL 1.2.1 specification does not allow %0 attribute applied to a %select.."?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, something like this... But to be honest, I'm not very good at wording.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

SYCL 1.2.1 specification does not allow SYCL_EXTERNAL to be applied to
a function with a pointer argument or with a pointer return
value. This is required to limit address space inference work to a
single translation unit.

Given that we make inference after we link all translation units
together, it should not really matter now. And there are several cases
where external functions with pointers can be useful, so this patch
tuns an error into a warning.

Signed-off-by: Andrew Savonichev <andrew.savonichev@intel.com>
@asavonic asavonic force-pushed the private/asavonic/sycl-external-ptr branch from f73cc65 to cdc6008 Compare November 27, 2019 16:22
@romanovvlad
Copy link
Contributor

will be emitted because we are going to use possibility allowed by t

Do we have plans to forbid it by default and allow it if some compiler option is passed only?

@asavonic
Copy link
Contributor Author

will be emitted because we are going to use possibility allowed by t

Do we have plans to forbid it by default and allow it if some compiler option is passed only?

Both the option and the warning work fine for my use case. I don't have an opinion on what should be the default.

@Fznamznon
Copy link
Contributor

will be emitted because we are going to use possibility allowed by t

Do we have plans to forbid it by default and allow it if some compiler option is passed only?

Both the option and the warning work fine for my use case. I don't have an opinion on what should be the default.

How about the driver option then?

@asavonic
Copy link
Contributor Author

will be emitted because we are going to use possibility allowed by t

Do we have plans to forbid it by default and allow it if some compiler option is passed only?

Both the option and the warning work fine for my use case. I don't have an opinion on what should be the default.

How about the driver option then?

Sounds like this should be a part of #806.

@bader
Copy link
Contributor

bader commented Nov 29, 2019

Sounds like this should be a part of #806.

What do you mean by that? I agree with @Fznamznon: if extension requires compiler option, it should be added together with the feature.

@asavonic
Copy link
Contributor Author

Sounds like this should be a part of #806.

What do you mean by that? I agree with @Fznamznon: if extension requires compiler option, it should be added together with the feature.

What feature do you refer to? This patch turns an error into a warning. Specification doesn't mention what exactly should happen, so it is an NFC patch from the specification perspective.
If you want a command line option to tweak this behavior, consider using -Wno-sycl or -Werror=sycl.

…cl-strict

Signed-off-by: Andrew Savonichev <andrew.savonichev@intel.com>
AlexeySachkov
AlexeySachkov previously approved these changes Dec 3, 2019
Copy link
Contributor

@AlexeySachkov AlexeySachkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Andrew Savonichev <andrew.savonichev@intel.com>
Copy link
Contributor

@bader bader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One nit left.

clang/include/clang/Basic/DiagnosticSemaKinds.td Outdated Show resolved Hide resolved
Signed-off-by: Andrew Savonichev <andrew.savonichev@intel.com>
@rolandschulz
Copy link
Contributor

Sounds like this should be a part of #806.

What do you mean by that? I agree with @Fznamznon: if extension requires compiler option, it should be added together with the feature.

What feature do you refer to? This patch turns an error into a warning. Specification doesn't mention what exactly should happen, so it is an NFC patch from the specification perspective.
If you want a command line option to tweak this behavior, consider using -Wno-sycl or -Werror=sycl.

I disagree. I think the spec intention is clear that this should be an error. I think this needs an extension doc in sycl/sycl/doc/extensions and needs to be only enabled if the extension is enabled.

@asavonic
Copy link
Contributor Author

asavonic commented Dec 4, 2019

Sounds like this should be a part of #806.

What do you mean by that? I agree with @Fznamznon: if extension requires compiler option, it should be added together with the feature.

What feature do you refer to? This patch turns an error into a warning. Specification doesn't mention what exactly should happen, so it is an NFC patch from the specification perspective.
If you want a command line option to tweak this behavior, consider using -Wno-sycl or -Werror=sycl.

I disagree. I think the spec intention is clear that this should be an error. I think this needs an extension doc in sycl/sycl/doc/extensions and needs to be only enabled if the extension is enabled.

The latest revision of the patch works as you described.

Copy link
Contributor

@Fznamznon Fznamznon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bader bader merged commit 2840458 into intel:sycl Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants